## Check that llvm-objcopy preserves AArch64 mapping symbols for relocatable files.
# RUN: yaml2obj %s -o %t.o -DTYPE=REL
# RUN: llvm-objcopy --strip-unneeded %t.o %t1.o
# RUN: llvm-nm -j --special-syms %t1.o | FileCheck %s --match-full-lines
# RUN: llvm-objcopy --discard-all %t.o %t2.o
# RUN: llvm-nm -j --special-syms %t2.o | FileCheck %s --match-full-lines

# CHECK:      $d
# CHECK-NEXT: $d.d
# CHECK-NEXT: $x
# CHECK-NEXT: $x.x

## A mapping symbol can be deleted if specified explicitly.
# RUN: llvm-objcopy -w -N '$d*' %t.o %t3.o
# RUN: llvm-nm --special-syms %t3.o | FileCheck /dev/null --implicit-check-not='$d'

## Mapping symbols are not preserved for executable files
# RUN: yaml2obj %s -o %t.exec -DTYPE=EXEC
# RUN: llvm-objcopy --strip-unneeded %t.exec %t1.exec
# RUN: llvm-nm --special-syms %t1.exec | count 0

# RUN: yaml2obj %s -o %t.so -DTYPE=DYN
# RUN: llvm-objcopy --strip-unneeded %t.so %t1.so
# RUN: llvm-nm --special-syms %t1.so | count 0

!ELF
FileHeader:
  Class:    ELFCLASS64
  Data:     ELFDATA2LSB
  Type:     ET_[[TYPE]]
  Machine:  EM_AARCH64
Sections:
  - Name: .text
    Type: SHT_PROGBITS
Symbols:
  - Name:     $a
    Section:  .text
  - Name:     $d
    Section:  .text
  - Name:     $dd
    Section:  .text
  - Name:     $d.d
    Section:  .text
  - Name:     $m
    Section:  .text
  - Name:     $t.t
    Section:  .text
  - Name:     $x
    Section:  .text
  - Name:     $xx
    Section:  .text
  - Name:     $x.x
    Section:  .text
